/* Copyright 2007 dnAnalytics Project.
 *
 * Contributors to this file:
 * Patrick van der Velde
 * Marcus Cuda - http://marcus.cuda.net
 *
 * This file is part of dnAnalytics.  dnAnalytics is licensed under the 
 * Microsoft Public License. See License.txt for a complete copy of the
 * license.
 */
using dnAnalytics.Math;

namespace dnAnalytics.LinearAlgebra
{
    public partial class DenseMatrix
    {
        /// <summary>
        /// Multiplies each element of this matrix with a scalar.
        /// </summary>
        /// <param name="scalar">The scalar to multiply with.</param>
        public override void Multiply(double scalar)
        {
            if (FloatingPointUtilities.EqualsWithinSignificantFigures(1.0, scalar, 15))
            {
                return;
            }
            for (int i = 0; i < mData.Length; i++)
            {
                mData[i] *= scalar;
            }
        }
    }
}